﻿using FingerTip.Sms.Aliyun.Helper;
using System;
using System.Collections.Generic;
using System.Text;

namespace FingerTip.Sms.Aliyun.Builder
{
    public class AliyunSmsBuilder
    {
        private Action<string, string> _loggerAction;

        private Func<IAliyunSmsSetting> _getSettingsFunc;

        public static AliyunSmsBuilder Create()
        {
            return new AliyunSmsBuilder();
        }

        public AliyunSmsBuilder WithLoggerAction(Action<string, string> loggerAction)
        {
            _loggerAction = loggerAction;
            return this;
        }

        public AliyunSmsBuilder SetSettingsFunc(Func<IAliyunSmsSetting> getSettingFunc)
        {
            _getSettingsFunc = getSettingFunc;
            return this;
        }

        public void Builder()
        {
            if (_loggerAction != null)
            {
                AliyunSmsHelper.LoggerAction = _loggerAction;
            }
            if (_getSettingsFunc != null)
            {
                AliyunSmsHelper.GetSettingsFunc = _getSettingsFunc;
            }
        }
    }
}
